package com.jf.spring.component;

import org.springframework.stereotype.Controller;

import javax.annotation.Resource;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:22954
 * Date:2024-10-23
 * Time:0:38
 */
@Controller
public class AdminServlet {
    /*
    @Resource注释后, Spring会自动在IOC容器中匹配bean并装配
        1.@Resource  表示为默认情况,先按byName匹配,再按byType匹配,若都匹配失败则抛出异常
        2.@Resource(name = "id")  表示按byName匹配,并指定匹配度的id
        3.@Resource(type = Xxx.class)  表示按byType匹配,并指定匹配的类型
    注意:
        字段注释注入不会调用set方法,通过反射直接装配赋值
     */
    @Resource
    //@Resource(name = "adminService")
    //@Resource(type = AdminServlet.class)
    private AdminService adminService;

    public AdminService getAdminService() {
        return adminService;
    }
}
